home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / misc / gnuplot-3.7src.lha / gnuplot-3.7src / gnuplot-3.7.lha / gnuplot-3.7 / term / v384.trm < prev    next >
Text File  |  1998-11-26  |  5KB  |  205 lines

  1. /*
  2.  * $Id: v384.trm,v 1.13 1998/04/14 00:18:13 drd Exp $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - v384.trm */
  7.  
  8. /*[
  9.  * Copyright 1990 - 1993, 1998
  10.  *
  11.  * Permission to use, copy, and distribute this software and its
  12.  * documentation for any purpose with or without fee is hereby granted,
  13.  * provided that the above copyright notice appear in all copies and
  14.  * that both that copyright notice and this permission notice appear
  15.  * in supporting documentation.
  16.  *
  17.  * Permission to modify the software is granted, but not the right to
  18.  * distribute the complete modified source code.  Modifications are to
  19.  * be distributed as patches to the released version.  Permission to
  20.  * distribute binaries produced by compiling modified sources is granted,
  21.  * provided you
  22.  *   1. distribute the corresponding source modifications from the
  23.  *    released version in the form of a patch file along with the binaries,
  24.  *   2. add special version identification to distinguish your version
  25.  *    in addition to the base release version number,
  26.  *   3. provide your name and address as the primary contact for the
  27.  *    support of your modified version, and
  28.  *   4. retain our contact information in regard to use of the base
  29.  *    software.
  30.  * Permission to distribute the released version of the source code along
  31.  * with corresponding source modifications in the form of a patch file is
  32.  * granted with same provisions 2 through 4 for binary distributions.
  33.  *
  34.  * This software is provided "as is" without express or implied warranty
  35.  * to the extent permitted by applicable law.
  36. ]*/
  37.  
  38. /*
  39.  * This file is included by ../term.c.
  40.  *
  41.  * This terminal driver supports:
  42.  *  Vectrix 384 - works with tandy color printer as well
  43.  *
  44.  * AUTHORS
  45.  *   roland@moncskermit.OZ (Roland Yap) 
  46.  * 
  47.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  48.  * 
  49.  */
  50.  
  51. /*
  52.  *    Vectrix 384 driver - works with tandy color printer as well
  53.  *  in reverse printing 8 color mode.
  54.  *  This doesn't work on Vectrix 128 because it redefines the
  55.  *  color table. It can be hacked to work on the 128 by changing
  56.  *  the colours but then it will probably not print best. The color
  57.  *  table is purposely designed so that it will print well
  58.  *
  59.  */
  60.  
  61. /*
  62.  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
  63.  */
  64.  
  65. #include "driver.h"
  66.  
  67. #ifdef TERM_REGISTER
  68. register_term(vx384)
  69. #endif
  70.  
  71. #ifdef TERM_PROTO
  72. TERM_PUBLIC void V384_init __PROTO((void));
  73. TERM_PUBLIC void V384_graphics __PROTO((void));
  74. TERM_PUBLIC void V384_text __PROTO((void));
  75. TERM_PUBLIC void V384_linetype __PROTO((int linetype));
  76. TERM_PUBLIC void V384_move __PROTO((unsigned int x, unsigned int y));
  77. TERM_PUBLIC void V384_vector __PROTO((unsigned int x, unsigned int y));
  78. TERM_PUBLIC void V384_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
  79. TERM_PUBLIC void V384_reset __PROTO((void));
  80.  
  81. #define V384_XMAX 630
  82. #define V384_YMAX 480
  83.  
  84. #define V384_XLAST (V384_XMAX - 1)
  85. #define V384_YLAST (V384_YMAX - 1)
  86.  
  87. #define V384_VCHAR    12
  88. #define V384_HCHAR    7
  89. #define V384_VTIC    8
  90. #define V384_HTIC    7
  91. #endif /* TERM_PROTO */
  92.  
  93. #ifndef TERM_PROTO_ONLY
  94. #ifdef TERM_BODY
  95.  
  96. TERM_PUBLIC void V384_init()
  97. {
  98.     fprintf(gpoutfile, "%c%c  G0   \n\
  99. Q 0 8\n\
  100. 0 0 0\n\
  101. 255 0 0\n\
  102. 0 255 0\n\
  103. 0 0 255\n\
  104. 0 255 255\n\
  105. 255 0 255\n\
  106. 255 255 0\n\
  107. 255 255 255\n",
  108.         27, 18);
  109. }
  110.  
  111.  
  112. TERM_PUBLIC void V384_graphics()
  113. {
  114.     fprintf(gpoutfile, "%c%c E0 RE N 65535\n", 27, 18);
  115. }
  116.  
  117.  
  118. TERM_PUBLIC void V384_text()
  119. {
  120.     fprintf(gpoutfile, "%c%c\n", 27, 17);
  121. }
  122.  
  123.  
  124. TERM_PUBLIC void V384_linetype(linetype)
  125. int linetype;
  126. {
  127.     static int color[] =
  128.     {
  129.     1 /* red */ ,
  130.     2 /* green */ ,
  131.     3 /* blue */ ,
  132.     4 /* cyan */ ,
  133.     5 /* magenta */ ,
  134.     6 /* yellow */ ,    /* not a good color so not in use at the moment */
  135.     7 /* white */
  136.     };
  137.  
  138.     if (linetype < 0)
  139.     linetype = 6;
  140.     else
  141.     linetype %= 5;
  142.  
  143.     fprintf(gpoutfile, "C %d\n", color[linetype]);
  144. }
  145.  
  146.  
  147. TERM_PUBLIC void V384_move(x, y)
  148. unsigned int x, y;
  149. {
  150.     fprintf(gpoutfile, "M %d %d\n", x + 20, y);
  151. }
  152.  
  153.  
  154. TERM_PUBLIC void V384_vector(x, y)
  155. unsigned int x, y;
  156. {
  157.     fprintf(gpoutfile, "L %d %d\n", x + 20, y);
  158. }
  159.  
  160.  
  161. TERM_PUBLIC void V384_put_text(x, y, str)
  162. unsigned int x, y;
  163. char str[];
  164. {
  165.     V384_move(x, y + V384_VCHAR / 2);
  166.     fprintf(gpoutfile, "$%s\n", str);
  167. }
  168.  
  169.  
  170. TERM_PUBLIC void V384_reset()
  171. {
  172. }
  173.  
  174. #endif /* TERM_BODY */
  175.  
  176. #ifdef TERM_TABLE
  177. TERM_TABLE_START(vx384_driver)
  178.     "vx384", "Vectrix 384 and Tandy color printer",
  179.     V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR,
  180.     V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset,
  181.     V384_text, null_scale, V384_graphics, V384_move, V384_vector,
  182.     V384_linetype, V384_put_text, null_text_angle,
  183.     null_justify_text, do_point, do_arrow, set_font_null
  184. TERM_TABLE_END(vx384_driver)
  185.  
  186. #undef LAST_TERM
  187. #define LAST_TERM vx384_driver
  188.  
  189. #endif /* TERM_TABLE */
  190. #endif /* TERM_PROTO_ONLY */
  191.  
  192. #ifdef TERM_HELP
  193. START_HELP(vx384)
  194. "1 vx384",
  195. "?commands set terminal vx384",
  196. "?set terminal vx384",
  197. "?set term vx384",
  198. "?terminal vx384",
  199. "?term vx384",
  200. "?vx384",
  201. " The `vx384` terminal driver supports the Vectrix 384 and Tandy color",
  202. " printers.  It has no options."
  203. END_HELP(vx384)
  204. #endif
  205.